import { http } from '../utils/request'

// 财务相关API
export const financeAPI = {
  // 查询司机余额
  getDriverBalance(driverId) {
    console.log('API调用 - 查询司机余额, driverId:', driverId)
    return http.get('/finance/api/driver/balance/', {
      params: { driver_id: driverId }
    })
  },

  // 增加余额
  increaseBalance(data) {
    return http.post('/finance/api/driver/balance/increase/', data)
  },

  // 减少余额
  decreaseBalance(data) {
    return http.post('/finance/api/driver/balance/decrease/', data)
  },

  // 查询交易记录
  getTransactionHistory(params = {}) {
    return http.get('/finance/api/driver/transactions/', { params })
  },

  // 司机收入分析
  getDriverIncomeAnalysis(params = {}) {
    console.log('API调用 - 司机收入分析:', params)
    return http.get('/finance/api/driver/income-analysis/', { params })
  },

  // 推送收入报告
  pushIncomeReport(data) {
    console.log('API调用 - 推送收入报告:', data)
    return http.post('/finance/api/driver/income-report/push/', data)
  },

  // 导出收入报告
  exportIncomeReport(data) {
    console.log('API调用 - 导出收入报告:', data)
    return http.post('/finance/api/driver/income-report/export/', data)
  }
}
